package com.tidc.consumer9001.controller;

import com.tidc.consumer9001.api.ProviderApi;
import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassNmae TestController
 * @Description TODO
 * @Author 14631
 **/
@RestController
public class TestController {
	private static final String REST_URL_PREFIX = "http://PROVIDER-8001";
//	private static final String REST_URL_PREFIX = "http://localhost:8001";
//	@Autowired
//	private RestTemplate restTemplate;
	@Autowired
	private ProviderApi providerApi;
//	Ribbon
//	@GetMapping("/test/{id}")
//	public String test(@PathVariable("id")int id){
//		return restTemplate.getForObject(REST_URL_PREFIX + "/test/"+id, String.class);
//	}
//	feign
	@GetMapping("/test2/{id}")
	public String test2(@PathVariable("id")int id){
		return providerApi.get(id);
	}
}
